How to set an Argument's Value at Run-time in a UX Component

Description

Arguments are server-side variables you can create in components and use in database queries, populate default values, and more. Learn how to change an argument's value at run-time using callbacks.

Discussion

If a UX Component is configured to have arguments, you can change the argument value at run-time using an Ajax Callback.

To change an argument's value:

  1. Make an Ajax Callback, either using the {dialog.object}.ajaxCallback() or Ajax Callback Action Javascript action.

  2. In the Xbasic function that handles the callback, add the following Xbasic:

    dim argName as c = "Name of argument"
    argValue = "value to set"
    
    e.arguments.set(argName, argValue)

    Where argName is the name of the argument and argValue is the value to set.